







KY-040 Rotary Encoder Module with Push-Button Switch
The KY-040 Rotary Encoder is a rotary input device that provides an indication of how much the shaft has been rotated and in which direction. Unlike a standard potentiometer, a rotary encoder has no fixed limits and can spin infinitely in either direction. It also features an integrated momentary push-button switch when you press the shaft downward, making it the perfect all-in-one component for menu navigation, volume adjustment, and digital tuning projects.
????️ Key Features
• 360° Infinite Rotation: Can turn continuously clockwise or counter-clockwise without any physical stop limits.
• Integrated Push-Button: Pressing down on the metal shaft activates a tactile momentary switch, perfect for "Select" or "Enter" actions in UI menus.
• Breadboard & Project Friendly: Mounted on a compact PCB breakout board with pre-soldered header pins for quick wiring.
• Digital Quadrature Output: Generates clear 2-bit gray code signals (CLK and DT) to easily calculate precise angular displacement and direction.
• Included Knob Cap: Comes complete with a sleek, ridged black knob (visible in ky-040.jpg) featuring a silver pointer mark for easy handling.
???? Technical Specifications
Parameter Specification
Operating Voltage $3.3\text{V} - 5\text{V}$ DC
Pulses Per Revolution (PPR) 20 pulses
Mechanical Life $\geq 30,000$ cycles
Switch Type Momentary tactile push switch
Shaft Diameter Approx. $6\text{mm}$ (D-shape shaft)
Dimensions Approx. $32\text{mm} \times 19\text{mm} \times 30\text{mm}$
???? Pinout Configuration
The module exposes 5 header pins, clearly labeled on the PCB as shown in ky-040.jpg:
• GND: Ground connection. Connect to your microcontroller's GND.
• + (VCC): Power supply connection
• SW (Switch): Push-button output. Drops LOW when the shaft is pressed. (Requires a pull-up resistor, internal or external).
• DT (Data): Same function as CLK, but outputs a signal shifted by 90 degrees to determine the direction of rotation.
• CLK (Clock): Primary output pulse used to determine the amount of rotation.


-250x250w.jpg)





-250x250.jpg)



-250x250.jpg)